package com.news.m;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import com.campus.utils.Http;

/*
 * ��Ϣ����
 * */
public class InfoAnnoucement extends AbNewsRequest {
int page;
public static final String urlheader="view-source:http://www.xaufe.edu.cn/Components/GetPage.aspx?";
	@Override
	public
	ArrayList<NewsDAO> next() throws MalformedURLException, IOException {
		// TODO Auto-generated method stub
		ArrayList<NewsDAO> list=new ArrayList<NewsDAO>();
		String resp=Http.get("http://www.xaufe.edu.cn/Components/GetPage.aspx?1","GBK");
		Document doc=Jsoup.parse(resp);
		//Elements ele=doc.
		
		Elements ee = doc.select("tr").select("td");
		for(Element e:ee)
		{
			//System.out.println(e.getElementsByTag("a").first().attr("title"));

			//System.out.println(e.getElementsByTag("a").first().attr("href"));

			//System.out.println(e.getElementsByTag("font").first().text());
			String url=e.getElementsByTag("a").first().attr("href");
			url=url.substring(2,url.length()-2);
			String title=e.getElementsByTag("a").first().attr("title");
		    title=title.substring(2,title.length()-2);
		      String date=e.getElementsByTag("font").first().text();
		url="http://www.xaufe.edu.cn/Announcement/"+url;
		      System.out.println(url);
			System.out.println(title);
			System.out.println(date);
			 NewsDAO news=(new NewsDAO(title, url, date));
			 news.sub=title;
			 list.add(news);
		}                                                             
		
		return list;
	}

	

}
